package com.chenziwen.scala.chapter06

object Scala_Trait8 {
  def main(args: Array[String]): Unit = {
    var e = new MyException
    println(e)
  }
}

trait LoggedException extends Exception {
  def log(): Unit = {
    // 方法来自于Exception类
    println(getMessage())
  }
}

class UnhappyException extends LoggedException {
  // 已经是Exception的子类了，所以可以重写方法
  override def getMessage = "错误消息！"
}
class AAA extends Exception {

}
class MyException extends AAA with LoggedException {

}